let t = require;
let e = module
let o = e.exports;
o.default = e.exports;

'use strict';
console.log("start");
var _n37,
    i =
        (this && this.__extends) ||
        ((_n37 = function n(t, e) {
            return (_n37 =
                Object.setPrototypeOf ||
                ({
                    __proto__: []
                }
                    instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) {
                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                    }
                })(t, e);
        }),
            function (t, e) {
                function o() {
                    this.constructor = t;
                }
                _n37(t, e),
                    (t.prototype =
                        null === e ?
                            Object.create(e) :
                            ((o.prototype = e.prototype), new o()));
            }),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var i,
                r = arguments.length,
                a =
                    r < 3 ?
                        e :
                        null === n ?
                            (n = Object.getOwnPropertyDescriptor(e, o)) :
                            n;
            if (
                'object' ==
                (typeof Reflect === 'undefined' ?
                    'undefined' :
                    typeof (Reflect)) &&
                'function' == typeof Reflect.decorate
            )
                a = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--) {
                    (i = t[s]) &&
                        (a = (r < 3 ? i(a) : r > 3 ? i(e, o, a) : i(e, o)) || a);
                }
            return r > 3 && a && Object.defineProperty(e, o, a), a;
        };
Object.defineProperty(o, '__esModule', {
    value: !0
}),
    (o.BattleResultPanel = void 0);
var a = t('UIPanel'),
    s = t('UIViewRes'),
    c = t('UILayer'),
    l = t('ComUtils'),
    u = t('SoundMrg'),
    h = t('GameSDK'),
    p = t('UIMrg'),
    f = t('AwardItem'),
    d = t('BagMrg'),
    g = t('MainPanel'),
    _ = t('ItemContainer'),
    y = t('BattleUtils'),
    C = t('ChapterPanel'),
    m = t('ActivityPanel'),
    v = t('UmaSdkHelper'),
    b = t('LangCfg'),
    M = cc._decorator,
    I = M.ccclass,
    A =
        (M.property,
            (function (t) {
                function e() {
                    return (null !== t && t.apply(this, arguments)) || this;
                }
                return (
                    i(e, t),
                    (e.prototype.onInit = function () {
                        t.prototype.onInit.call(this),
                            (this._anim = this.view.getComponent(cc.Animation)),
                            (this.loseMask = l.default.getNode(this.view, 'loseMask')),
                            (this.winMask = l.default.getNode(this.view, 'winMask')),
                            (this._container = new _.ItemContainer(
                                l.default.getNode(this.view, 'root/container'),
                                f.AwardItem
                            ));
                        var e = l.default.getNode(this.view, 'root/btnVideoAd');
                        e.on(
                            cc.Node.EventType.TOUCH_END,
                            this.onTouchVideoAdHandler,
                            this
                        ),
                            (this.btnVideoAd = e);
                        var o = l.default.getNode(this.view, 'root/btnReceive');
                        o.on(
                            cc.Node.EventType.TOUCH_END,
                            this.onTouchReceiveHandler,
                            this
                        ),
                            (this.btnReceive = o);
                        var n = l.default.getNode(this.view, 'root/btnExit');
                        n.on(
                            cc.Node.EventType.TOUCH_END,
                            this.onTouchExitHandler,
                            this
                        ),
                            (this.btnExit = n);
                    }),
                    (e.prototype.onLang = function () {
                        var t = l.default.getComponent(
                            cc.Label,
                            this.view,
                            'root/btnReceive/Background/txtLabel'
                        );
                        (t.string = b.LangCfg.ins.getContent(201600)),
                            ((t = l.default.getComponent(
                                cc.Label,
                                this.view,
                                'root/btnVideoAd/Background/New Layout/txtLabel'
                            )).string = b.LangCfg.ins.getContent(201601));
                    }),
                    (e.prototype.onShow = function () {
                        t.prototype.onShow.call(this),
                            (this._vo = this.getData()),
                            this._anim.play('BattleResultView'),
                            (this.loseMask.active = !this._vo.win),
                            (this.winMask.active = this._vo.win),
                            (this.btnVideoAd.opacity = 0),
                            (this.btnReceive.opacity = 0),
                            (this.btnExit.opacity = 0),
                            (this.btnVideoAd.active = !1),
                            (this.btnReceive.active = !1),
                            (this.btnExit.active = !1),
                            this.delayCall(0.2, this.refreshReward),
                            u.SoundMrg.playAudio('battleResult');
                    }),
                    (e.prototype.refreshReward = function () {
                        var t = this._vo.data;
                        this._vo.win ?
                            this._container.setData(y.default.getChapterRewards(t)) :
                            this._container.setData(
                                y.default.getChapterLoseRewards(t)
                            ),
                            this._container.count > 0 ?
                                ((this.btnVideoAd.active = !0),
                                    (this.btnReceive.active = !0),
                                    cc
                                        .tween(this.btnVideoAd)
                                        .delay(0.1 * this._container.count)
                                        .to(0.5, {
                                            opacity: 255
                                        })
                                        .start(),
                                    cc
                                        .tween(this.btnReceive)
                                        .delay(0.1 * this._container.count)
                                        .to(0.5, {
                                            opacity: 255
                                        })
                                        .start()) :
                                ((this.btnExit.active = !0),
                                    cc
                                        .tween(this.btnExit)
                                        .delay(0.1 * this._container.count)
                                        .to(0.5, {
                                            opacity: 255
                                        })
                                        .start());
                    }),
                    (e.prototype.onClose = function () {
                        t.prototype.onClose.call(this);
                        var e = this._vo.data;
                        this._container.removeComs(),
                            p.UIMrg.show(g.MainPanel),
                            1 == e.type ?
                                p.UIMrg.show(C.ChapterPanel) :
                                p.UIMrg.show(m.ActivityPanel);
                    }),
                    (e.prototype.onTouchVideoAdHandler = function () {
                        if (!l.default.getNode(this.view, 'root/btnVideoAd').getComponent(cc.Button).interactable) return;
                        u.SoundMrg.click(),
                            h.default.videoAdBuy(
                                0,
                                '双倍奖励',
                                this.onVideoAdHandler,
                                this
                            ),
                            v.default.chapterReward(v.UmaSdkGainType.AdVideo);
                    }),
                    (e.prototype.onTouchReceiveHandler = function () {
                        u.SoundMrg.click(),
                            this.receiveAward(),
                            p.UIMrg.close(this),
                            v.default.chapterReward(v.UmaSdkGainType.Free);
                    }),
                    (e.prototype.onTouchExitHandler = function () {
                        u.SoundMrg.click(), p.UIMrg.close(this);
                    }),
                    (e.prototype.onVideoAdHandler = function () {
                        this.receiveAward(2), p.UIMrg.close(this);
                    }),
                    (e.prototype.receiveAward = function (t) {
                        void 0 === t && (t = 1), this._vo.data;
                        for (var e = 0; e < this._container.count; e++) {
                            var o = this._container.data[e];
                            d.BagMrg.ins.addItem(o[0], o[1] * t);
                        }
                    }),
                    (e.RES = new s.UIViewRes(
                        'BattleResultView',
                        'Battle',
                        c.UILayer.PopLayer
                    )),
                    r([I('BattleResultPanel')], e)
                );
            })(a.default));
(o.BattleResultPanel = A), console.log("end");
module.exports = e.exports;